package com.ruoyi.project.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.project.mapper.MpMTStudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.mapper.MTStudentMapper;
import com.ruoyi.project.domain.MTStudent;
import com.ruoyi.project.service.IMTStudentService;

/**
 * 学生信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-07-28
 */
@Service
public class MTStudentServiceImpl implements IMTStudentService 
{
    @Autowired
    private MTStudentMapper mTStudentMapper;

    @Autowired
    private MpMTStudentMapper mpMTStudentMapper;

    /**
     * 查询学生信息
     * 
     * @param id 学生信息主键
     * @return 学生信息
     */
    @Override
    public MTStudent selectMTStudentById(String id)
    {
        return mTStudentMapper.selectMTStudentById(id);
    }

    /**
     * 查询学生信息列表
     * 
     * @param mTStudent 学生信息
     * @return 学生信息
     */
    @Override
    public List<MTStudent> selectMTStudentList(MTStudent mTStudent)
    {
        // 1. 测试使用mybatisPlus

        String usercode = "ST0728001";
        String name = "fafa";
        String email = "259865124@qq.com";
        // 2.取数据为前五条的数据
        QueryWrapper<MTStudent> studentQueryWrapper = new QueryWrapper<>();
        studentQueryWrapper.eq(usercode,mTStudent.getUsercode());
        studentQueryWrapper.eq(email,mTStudent.getEmail());
        studentQueryWrapper.eq(name,mTStudent.getName() );
        List<MTStudent> studentList = mpMTStudentMapper.selectList(null);

        studentList.forEach(System.out::println);
        return mTStudentMapper.selectMTStudentList(mTStudent);
    }

    @Override
    public List<MTStudent> selectMTStudentListByStus(List<MTStudent> mTStudents) {
        return mTStudentMapper.selectMTStudentListByStus(mTStudents);
    }

    /**
     * 新增学生信息
     * 
     * @param mTStudent 学生信息
     * @return 结果
     */
    @Override
    public int insertMTStudent(MTStudent mTStudent)
    {
        return mTStudentMapper.insertMTStudent(mTStudent);
    }

    /**
     * 修改学生信息
     * 
     * @param mTStudent 学生信息
     * @return 结果
     */
    @Override
    public int updateMTStudent(MTStudent mTStudent)
    {
        return mTStudentMapper.updateMTStudent(mTStudent);
    }

    /**
     * 批量删除学生信息
     * 
     * @param ids 需要删除的学生信息主键
     * @return 结果
     */
    @Override
    public int deleteMTStudentByIds(String[] ids)
    {
        return mTStudentMapper.deleteMTStudentByIds(ids);
    }

    /**
     * 删除学生信息信息
     * 
     * @param id 学生信息主键
     * @return 结果
     */
    @Override
    public int deleteMTStudentById(String id)
    {
        return mTStudentMapper.deleteMTStudentById(id);
    }
}
